<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<%@page import="com.minshenglife.zanzan.entity.power.MUserPower"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%> 
<html>
<head>
<%@ include file="common.jsp" %>
<%
MUserPower user = (MUserPower)session.getAttribute("app_user");
String flag = user.getIsAdmin();
System.out.println(flag);
%>
<title><%=proName%></title>
</head>

<body>
	<c:set var="flag" value="<%=flag %>"/>
	<c:if test="${flag=='Y' }">
		<jsp:include page="./menu.jsp"></jsp:include>
	</c:if>
    <c:if test="${flag=='N' }">
		<jsp:include page="./menu2.jsp"></jsp:include>
	</c:if> 
	
	<div  id="bread_crumbs">
        <a>修改密码</a>
    </div>
    <div id="body">
        <div id="navTop">
            <div class="bg_left"></div>
            <div class="bg_main"></div>
            <div class="bg_right"></div>
        </div>
        <div id="userManager">
            <table width="100%" cellpadding="0" cellspacing="0" border="0" class="maintable">
                <tr>
                    <th colspan="4" align="left" valign="middle">
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <th>
                                    <span id="search_icon" class="search_icon"></span>
                                </th>
                                <th height="30px">
                                    <span style="margin-left: 2px;">修改密码</span>
                                </th>
                            </tr>
                        </table>
                    </th>
                </tr>
                <tr>
                    <td>
                            <table width="100%" cellpadding="0" cellspacing="0" border="0" >
                                <tr>
                                    <td align="left">
                                        <table cellpadding="0" cellspacing="0" border="0" style="border-collapse: separate;border-spacing: 10px;">
                                             <tr>
                                                <td width="100px" ><span>密码</span></td>
                                                <td width="5px"><strong>：</strong></td>
                                                <td><input type="text"  id="password" name="password" value="" style="width:178px" placeholder="密码位数不得低于8位数"/></td></td>
                                         	</tr>
                                         	<tr>
                                                <td width="100px" ><span>密码确认</span></td>
                                               <td width="5px"><strong>：</strong></td>
                                                <td><input type="text"  id="passwordConfirm" name="passwordConfirm" value=""  style="width:178px" /></td></td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <th colspan="6" align="right">
                                        <input id="confirm" type="button" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false" value="确认" onclick="confirmPassword()" onmouseover="this.style.background='#FFF18B'" onmouseout="this.style.background='#F1EDD2'"/>
                                    </th>
                                </tr>
                            </table>
                    </td>
                </tr>
            </table>
            <div id="pagernav"></div>
            <div id="rolesDialog" style="display: none; height: 300px">
                <div id="treeScroll">
                    <div id="treebox_group"></div>
                </div>
            </div>
        </div>
    </div>
    <jsp:include page="./footer.jsp"></jsp:include>
    <script type="text/javascript">
        function select1(){
            selectForm.action=rootPath + "/managers/redCountByTime.mge";
            selectForm.target="_self";
            selectForm.submit();
        }
        
        function confirmPassword(){
        	var password = $("#password").val();
        	var passwordConfirm =$("#passwordConfirm").val();
        	if(password==null||password.length<8){
        		alert("密码位数不可以低于8位数，请重新输入！！")
        		return;
        	}
        	if(password!=passwordConfirm){
        		alert("密码不一致，请重新输入！！")
        		return;
        	}
        	$.ajax({
        		url:rootPath+"/workConPower/updatePassword.mge",
        		type:"POST",
        		dataType:"text",
        		data:{
        			password:password,
        			passwordConfirm:passwordConfirm
        		},
        		success:function(response){
        	  		var data=$.parseJSON(response);
        	  		
        			if(data.state=="200"){
        				alert(data.msg);
        				location.href=rootPath+"/manage/login.jsp";
        			}else{
        				alert(data.msg);
        			}
        		}
        	});
        }
        //function resetConditions(){
        //  document.getElementById("order").selectedIndex=0;
        //  document.getElementById("dept").selectedIndex=0;
        //  document.getElementById("startDate").value="";
        //  document.getElementById("endDate").value="";
        //  document.getElementById("empId").value="";
        //  document.getElementById("emp_name").value="";
        //}
    </script> 
</body>
</html>
